import request from '@/utils/request'

// 查询码上放心往来单位列表
export function listMsfxCustomer(query) {
  return request({
    url: '/basic/customerComparison/msfxList',
    method: 'get',
    params: query
  })
}

// 查询ERP往来单位列表
export function listErpCustomer(query) {
  return request({
    url: '/basic/customerComparison/erpList',
    method: 'get',
    params: query
  })
}


// 查询映射关系列表
export function listCustomerMapping(query) {
  return request({
    url: '/basic/customerComparison/mappingList',
    method: 'get',
    params: query
  })
}


// 快速创建映射关系
export function quickCreateMapping(data) {
  return request({
    url: '/basic/customerComparison/quickMapping',
    method: 'post',
    params: data
  })
}

// 批量创建映射关系
export function batchCreateMapping(data) {
  return request({
    url: '/basic/customerComparison/batchMapping',
    method: 'post',
    data: data
  })
}


// 删除映射关系
export function delCustomerMapping(ids) {
  return request({
    url: '/basic/customerComparison/mapping/' + ids,
    method: 'delete'
  })
}

// 审核映射关系
export function auditMapping(data) {
  return request({
    url: '/basic/customerComparison/mapping/audit',
    method: 'post',
    params: data
  })
}

// 解除映射关系
export function removeMapping(mappingId) {
  return request({
    url: `/basic/customerComparison/mapping/remove/${mappingId}`,
    method: 'post'
  })
}


// 预览自动匹配结果
export function previewAutoMatch() {
  return request({
    url: '/basic/customerComparison/autoMatchPreview',
    method: 'get'
  })
}

// 执行自动匹配
export function executeAutoMatch() {
  return request({
    url: '/basic/customerComparison/autoMatch',
    method: 'post',
    timeout: 120000 // 设置2分钟超时
  })
}
